← cd ..
·3 min read·author: Manikanta

Snowflake + DBT Setup in Linux (Part 1)

Learn how to install dbt with the Snowflake adapter on Linux, configure a Snowflake connection, and create your first dbt project from scratch.

Snowflake + DBT Setup in Linux (Part 1)

Data transformation is one of the most important stages in modern data engineering. While Snowflake provides a powerful cloud data warehouse, dbt (Data Build Tool) enables analytics engineers and data engineers to transform raw data into clean, reusable models using SQL and version control.

In this blog, we'll install dbt with the Snowflake adapter on Linux, configure the Snowflake connection, and create our first dbt project.


Prerequisites

Before starting, ensure you have the following installed:

  1. Create a Snowflake Free Trial account (No credit card required).
  2. Install Python 3.8 or later.
  3. Install pip3.

Step 1: Create a Python Virtual Environment

A virtual environment keeps your Python dependencies isolated from the system Python installation.

Install Python Virtual Environment

sudo apt install python3-venv -y

Create a virtual environment named dbt-env.

python3 -m venv ~/dbt-env

Activate the environment.

source ~/dbt-env/bin/activate

After activation, your terminal prompt will look similar to:

(dbt-env) ubuntu@vm:~$

Note: You must activate the virtual environment every time you open a new terminal session before running dbt commands.


Step 2: Install dbt for Snowflake

Upgrade pip first.

pip install --upgrade pip

Install dbt along with the Snowflake adapter.

pip install dbt-snowflake

This command installs:

  • dbt-core
  • dbt-snowflake
  • snowflake-connector-python

The installation typically takes around 2–3 minutes.

Verify the installation.

dbt --version

Expected output:

Core:
  - installed: 1.8.x

Plugins:
  - snowflake: 1.8.x

Step 3: Configure Snowflake Connection

Create the .dbt directory.

mkdir -p ~/.dbt

Create the profiles.yml file.

vi ~/.dbt/profiles.yml

You can obtain your Snowflake account identifier from:

Profile
   → Account
      → View Account Details
         → Config File

Add the following configuration. (In Snowflake, Profile >> Account >> View Account details >> Config file)

ecommerce_dbt:
  target: dev

  outputs:
    dev:
      type: snowflake
      account: ABC12345.ap-southeast-1
      user: YOUR_USERNAME
      password: YOUR_PASSWORD
      role: SYSADMIN
      warehouse: COMPUTE_WH
      database: ECOMMERCE_DB
      schema: RAW
      threads: 4
      query_tag: dbt_tutorial

Give appropriate permissions.

chmod +x ~/.dbt/profiles.yml

Step 4: Create Your First dbt Project

Create a directory for your projects.

mkdir ~/projects

Navigate to it.

cd ~/projects

Initialize a new dbt project.

dbt init ecommerce_dbt

dbt will ask you to choose the database adapter. if it asks account details you can use same data such as db name,schema name etc used in profile.yaml file

Which database adapter?

Type:

snowflake

Press Enter.

dbt automatically creates the project folder structure.

Move inside the project.

cd ecommerce_dbt

Step 5: Test the Connection

Run the following command.

dbt debug

If everything is configured correctly, you should see output similar to:

Connection test: OK
All checks passed!

Congratulations! 🎉

Your Linux machine is now successfully connected to Snowflake using dbt.


Project Structure

After initialization, your project will look similar to:

ecommerce_dbt/
├── analyses/
├── macros/
├── models/
├── seeds/
├── snapshots/
├── tests/
├── dbt_project.yml
└── README.md

We'll explore each of these folders in the next blog.


Summary

In this blog, we covered:

  • Creating a Snowflake free trial account
  • Installing Python and pip
  • Creating a Python virtual environment
  • Installing dbt with the Snowflake adapter
  • Configuring the Snowflake connection
  • Creating a new dbt project
  • Testing the connection using dbt debug